package com.heima.search.controller.v1;

import com.heima.model.common.dtos.common.ResponseResult;
import com.heima.search.pojo.ApUserSearch;
import com.heima.search.service.ApUserSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/history")
public class HistoryController {
    @Autowired
    private ApUserSearchService apUserSearchService;
    /**
     * 加载搜索历史
     */
    @PostMapping("/load")
    public ResponseResult loadHistory() {
        return apUserSearchService.historyLoad();
    }

    /**
     * 删除指定搜索记录
     * @param apUserSearch
     * @return
     */
    @PostMapping("/del")
    public ResponseResult delHistory(@RequestBody ApUserSearch apUserSearch) {
        return apUserSearchService.historyDel(apUserSearch);
    }
}
